﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ASP_Web_Interface.DBCtrlServiceRef;
using System.Web.Services;
using ModelLayer;

namespace ASP_Web_Interface
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        [WebMethod(EnableSession=false)]
        public static void saveMarker(float longitude, float latitude)
        {
            Coordinates coord = new Coordinates(longitude, latitude);
            DBCtrlClient client = new DBCtrlClient();
            client.addNode("", coord, ModelLayer.Type.TrafficJam, DateTime.Now);
        }

        [WebMethod(EnableSession = false)]
        public static List<Coordinates> loadMarkers()
        {
            DBCtrlClient client = new DBCtrlClient();
            List<Coordinates> coords = new List<Coordinates>();
            Node[] nodes = client.getNodes();
            foreach (Node node in nodes)
                coords.Add(node.Coordinates);
            return coords;
        }
    }
}
